package com.ftg.learn.day05.giteelogin.userui;

import com.ftg.learn.day05.giteelogin.service.UserService;

import java.util.Scanner;

/**
 * 模拟用户操作
 *  分层架构
 *
 * @author 布衣
 */
public class GiteeDemo {


    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.println("---=======================---");
        System.out.println("---=======================---");
        System.out.println("---========Gitee==========---");
        System.out.println("---=======================---");
        System.out.println("---=======================---");
        System.out.println("---=======================---");

        while(true){
            System.out.println("请选择你要的操作!? [1为注册功能，2为登陆功能,0表示退出系统]");
            int choose = scanner.nextInt();
            if(choose ==0){
                break;
            }
            switch (choose){
                case 1:
                    System.out.println("欢迎使用Gitee的注册功能。");
                    System.out.println("请输入您的用户编号");
                    int id = scanner.nextInt();

                    System.out.println("请输入您的用户名");
                    String name = scanner.next();

                    System.out.println("请输入您的密码");
                    String password = scanner.next();

                    System.out.println("请输入您的邮箱");
                    String mail = scanner.next();

                    System.out.println("请输入您的电话");
                    String tel = scanner.next();

                    System.out.println("请输入您的个人空间");
                    String personSpace = scanner.next();

                    UserService userService = new UserService();
                    boolean ist = userService.register(id, name, password, mail, tel, personSpace);
                    if (ist) {
                        System.out.println("注册成功");
                    } else {
                        System.out.println("注册失败");
                    }
                    break;
                case 2:
                    break;
                default:
                    System.out.println("输入错误，请重新输入");
            }
        }
    }

}
